/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package kaytto1;

import com.sun.lwuit.Form;
import com.sun.lwuit.TextArea;
import com.sun.lwuit.layouts.BoxLayout;

/**
 *
 * @author Joteitti
 */
public class SendForm extends Form {

    private HomeService homeService;
    private TextArea descriptionTextArea;

    public SendForm(HomeService homeService) {
        super();

        // Set home service
        this.homeService = homeService;

        // Create form layout and components
        setTitle(Text.getString(Text.TEXT_SEND_TITLE));
        addCommandListener(homeService);
        addCommand(homeService.getNewCommand());
        addCommand(homeService.getExitCommand());
        setTransitionOutAnimator(homeService.getTransition());
        setLayout(new BoxLayout(BoxLayout.Y_AXIS));
        addComponent(getDescriptionTextArea());
    }

    private TextArea getDescriptionTextArea() {
        // Lazy initialization
        if(descriptionTextArea == null) {
            descriptionTextArea = new TextArea(Text.getString(Text.TEXT_SEND_DESCRIPTION));
            descriptionTextArea.setConstraint(TextArea.UNEDITABLE );
            descriptionTextArea.setEditable(false);
            descriptionTextArea.setFocusPainted(false);
        }

        return descriptionTextArea;
    }
}
